package com.elink.enginerring.postbar.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.elink.enginerring.common.ErrorType;
import com.elink.enginerring.common.Pagination;
import com.elink.enginerring.postbar.PostbarCo;
import com.elink.enginerring.postbar.dao.PostbarMapper;
import com.elink.enginerring.util.JSONUtil;

@Service
public class PostbarService  implements IPostbarService{
	@Autowired
	private PostbarMapper postbarMapper;
	
	@Override
	public Map<String, Object> getList(PostbarCo co) {
		Map<String , Object> map = new HashMap<String, Object>();
		 map.put("list", postbarMapper.selectList(co));
		 map.put("pagination", new Pagination(co, postbarMapper.selectCount(co)));
		return JSONUtil.getJSON(ErrorType.SUCCESS,map);
	}
	
	@Override
	public Map<String, Object> addAuth(String ids,int authStatus) {
		postbarMapper.addAuth(ids,authStatus);
		return JSONUtil.getJSON(ErrorType.SUCCESS);
	}
}
